Skip to content

fix(metadata-protocol): search titles a reference-typed nameField by its target's title - #35292

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34175-palette-lookup-title
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34175-palette-lookup-title

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Fixes #34175

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:全局搜索 / ⌘K 面板里,对象的 nameField 是引用字段(lookup / master_detail / user / tree)时,命中标题不再显示目标记录的原始 id,而是显示目标记录自己的标题。
  • 为什么改:记录页头($expand)和活动时间线早已显示目标名称,只有搜索面板还在显示 id,用户无法分辨命中的是谁。
  • 风险与回滚:目标标题按搜索者本人身份读取(对象权限、行级范围、字段级安全全部生效),被拒的读者仍只看到 id;每个被搜对象只多一次批量读取。回滚即 revert 本 PR。
  • 先看:packages/metadata-protocol/src/protocol-record-reads.ts 的 readReferenceTitles(读取身份与拒绝分支),其次同文件 searchAll 中 hitRows 一段(批量收集 id)。
  • 两分钟验证:pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol.search-title-lookup.test.ts,预期 11 个测试全绿。
  • 需要你做的:无,席位落地。

What changes

searchAll → renderTitle returned row[nameField] as stored. When the pointer is a reference field, that value is the target record's id, so the palette titled such a hit by a raw key. Now:

  • The per-object sweep collects the pointer's ids from the rows it will turn into hits and reads the target's ADR-0079 title pointer (nameField, else the deprecated displayNameField) in one find(target, { where: { id: { $in } }, fields: ['id', title], limit }) per swept object. No N+1 per hit.
  • The target is the spec's referenceTargetOf answer (the same arbiter the $expand gate and engine ask), so user resolves to sys_user with no reference declared, and tree follows too.
  • The read is the searcher's: the caller's context goes to find, so the target's object gate, row scope and FLS apply as they do to $expand. A reader refused the target keeps the bare id:
    • the target's declared exposure does not serve get (canServeApiOperation) → not read;
    • canReadObject(target) false → not read;
    • the read throws PERMISSION_DENIED → no titles;
    • a row outside the row scope, or a title column FLS strips → that id keeps its value.
  • A target read that fails otherwise propagates, the same disposition the sweep gives a failing record read; a target whose table was never provisioned titles nothing (isMissingTableError).
  • The hit's wire shape does not change: record still carries the stored id, no $expand on the palette find. Only title changes.
  • No import from plugin-audit (resolveLookupTitles); metadata-protocol sits below it and below objectql.
  • The exposure decision is its own small function, servesSearchTitleTarget, and the new reference-target read is classified as a decided read in packages/core/src/security/second-object-read-exposure.pin.test.ts (CALLERS, plus the pinned list of decision functions). That pin reds any unclassified caller of referenceTargetOf. It was red on this PR's earlier head (Test Core 6/10) and is green now.

Tests

New packages/metadata-protocol/src/protocol.search-title-lookup.test.ts (11 cases): the title follows lookup, master_detail and user; one target read per swept object, as the searcher, id + title only; the wire shape; four refused-reader legs (object refused before the read, refusal thrown by the read, row scope, FLS strip); exposure without get; an outage propagates with its envelope (code + status); a text pointer pays no extra read.

Acceptance notes

  • Measured on main first, at d6d9645, with the new test file: the PIN answered { pm_1: 'per_1', pm_2: 'per_2', pm_3: 'per_1' }, so each hit was titled by the stored lookup id. 7 of 11 failed on main. The 4 that passed there are the refusal, exposure, wire-shape and control legs, which hold on main because main never follows the reference.
  • The card's named stock producer, sys_record_share.recipient_id, is a Field.text column (a polymorphic principal id read with recipient_type), not a reference field. So this fix does not change that object's palette title. Following it needs the recipient_type-keyed directory read the console's recipient-picker face does, which is a separate design. Stock objects with a reference nameField in this repo are sys_scim_subject (searchable: false) and sys_session (skipped by name prefix), so no stock object reaches the palette through this path. The reach is app objects, for example HotCRM's crm_project_member behind Record activity rows title a record by its raw lookup id when the object's nameField is a lookup ("Created Project Member \"gCX6SR…\"") #34055.
  • referenceNameVisible (ruling 6574398310) is not served here. A refused reader keeps the bare id, as the dispatch states. Serving a refused reader the target's name needs a system-context read, which is a new disclosure decision and not in this card.
  • One hop only: a target whose own title column is itself a reference shows that column's stored value.
  • A multi-valued reference pointer titles each element and joins them with , . When nothing resolves, the value is rendered exactly as before.
  • The searchAll method docblock in protocol.ts is not edited because it is outside this claim's file surface. The contract text for the new read is on readReferenceTitles and at the call site.

Verification

Red leg on main (d6d9645)
× THE PIN — a lookup pointer titles each hit by the target title, not the stored id
AssertionError: expected { pm_1: 'per_1', pm_2: 'per_2', …(1) } to deeply equal { pm_1: 'Ada Lovelace', …(2) }
Tests  7 failed | 4 passed (11)
Green, package suite and typecheck

Run at bc101ad (source identical to the current head; the later commit only adds a module-top import to the new test file, re-run green: Tests 11 passed (11) at 7e664c7).

pnpm --filter @objectstack/metadata-protocol typecheck   -> exit 0 (tsc --listFiles includes the new test file)
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2
 Test Files  358 passed | 9 skipped (367)
      Tests  23218 passed | 45 skipped (23263)
os-verify-lock: VERDICT command-exit 0
Ablation (committed fix, then mutated, then restored)

Deleted if (canReadObject && !(await canReadObject(target))) return titles; with scripts/ablation-replace.mjs: anchor 1 to 0, blob 35ced7511b80 to f92c32c63df5. Result: × REFUSED — an object-level refusal keeps the bare id, and the target is never read, Tests 1 failed | 10 passed (11). Restored: blob equals HEAD (35ced7511b80) and git diff HEAD is empty.

Derived gates and CI

Final head ff64484. dispatch-gates --commands derived 69 families. All 69 were run locally and every one exited 0. dispatch-gates --ran reported: 69 accounted for, 0 NOT-MEASURED, 0 UNRUN, exit 0. Pre-push overlap-check gave VERDICT clean exit 0.

Along the way:

  • check:test-source-alias failed on the new test file because it needed a module-top import '@objectstack/lint'. Fixed in 7e664c7.
  • check:lean-entry-closure first exited 3 because the objectql dist had not been built. After building objectql it exited 0.
  • On 7e664c7, CI Test Core (6/10) failed on the core second-object-read-exposure pin because the new caller was not yet classified. Fixed in ff64484; locally that pin gives Tests 4 passed (4).
  • CI Test Core (8/10) hit a 5000 ms timeout in plugin-security org-admin-assignment-boundary.posture.test.ts. That file is untouched here. Locally it gives Tests 104 passed (104), and it is green on ff64484.

CI check-runs on ff64484: every non-skipped run has completed/success. That includes Lint & Repo Gates, TypeScript Type Check, Test Core (10/10 shards), Build Core, Governed Surface Queue Guard, Test UI, Type Check UI, Build & E2E UI, Live E2E UI, Dogfood Regression Gate and Check Changeset.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me

…its target's title

searchAll rendered row[nameField] as stored, so an object whose primary-title
pointer is a lookup / master_detail / user field was titled in the palette and
global search by the target's raw id. The title now follows the reference to the
target's ADR-0079 title: one id-$in read per swept object, as the searcher, so a
reader refused the target (object, row or title column) keeps the bare id. The
hit's wire shape does not change.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
…h lookup title pin

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/metadata-protocol, touching 6 documentable anchor(s).

⛔ 1 release-owned page(s) name something this change touched. These are read-only:

  • content/docs/releases/v17/17-1.mdx (via searchAll (symbol, a top-level function))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: PERMISSION_DENIED (literal, 56 pages)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json bc75bcdbcda385cdae2cc2384b7307184fc3cb8c → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 6fc830263d6e82ed2edce6a83a46ec93666985e2 — the merge of head 6e7422813bddd2b80b836605077e989be9281cdc into base bc75bcdbcda385cdae2cc2384b7307184fc3cb8c, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 6fc830263d6e82ed2edce6a83a46ec93666985e2 && git checkout 6fc830263d6e82ed2edce6a83a46ec93666985e2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bc75bcdbcda385cdae2cc2384b7307184fc3cb8c 6e7422813bddd2b80b836605077e989be9281cdc && git checkout -B drift-repro bc75bcdbcda385cdae2cc2384b7307184fc3cb8c && git merge --no-ff 6e7422813bddd2b80b836605077e989be9281cdc

node scripts/docs-audit/affected-docs.mjs --json bc75bcdbcda385cdae2cc2384b7307184fc3cb8c

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs bc75bcdbcda385cdae2cc2384b7307184fc3cb8c → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
…object exposure pin

The search title read resolves a reference target through referenceTargetOf, so the
core pin requires it classified: a decided read, its exposure asked for get in
servesSearchTitleTarget, pinned by protocol.search-title-lookup.test.ts.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Final green head for L1: ff64484d3d05c0ab670d59c748da0926434faa16 · 2026-11-19T03:36Z

Checks at this head: 59 success, 13 skipped, 0 failed. Not governed (check-governed-merges.mjs --pr 35292: 0 of 4 paths, 457 lines). Clause-②: no (hit wire shape unchanged) · Metadata-protocol: none. Security-touching read path (a second-object read on the search title, run with the searcher's own context; refused reader keeps the bare id). os-dev report on #34175; file /mnt/project-files/objectstack-seat5/area-ux/ux-3/report-34175.md.
Sent to the L1 thread; the area lands after its ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 改了什么:⌘K 与全局搜索里,对象的标题字段若是引用字段(lookup / master_detail / user / tree),命中项标题改为被引用记录自己的标题,不再显示原始 id。
  • 为什么改:卡 ⌘K palette hit titles a record by its raw lookup id when the object's nameField is a lookup #34175。记录页抬头早已跟随引用显示名字,搜索还显示 id。
  • 风险与回滚:涉及安全读取:被引用记录以搜索者本人身份读取(对象权限、行范围、字段级安全全部生效),读不到的仍显示 id。命中结构不变,只改 title。回滚即 revert 本 PR。
  • 先看:protocol-record-reads.ts 的 readReferenceTitles 与 servesSearchTitleTarget;测试里 4 条「拒绝」用例。
  • 两分钟验证:跑 protocol.search-title-lookup.test.ts,11 条通过。
  • 需要你做的:无,区内落地(非受管面、457 行)。L1 意见:可落,无安全问题;main 已前进 18 个提交须先合并,顺带改一句 changeset;另欠两张后续卡。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head ff64484d3d05c0ab670d59c748da0926434faa16 · 2026-11-19T03:39Z

  • 形态: draft → main, 4 files, +451/−6, 4 commits. Fixes #34175 on its own line; no other card number sits beside a closing keyword. check-governed-merges --pr 35292: 0 of 4 paths governed, 457 lines ≤ 3000 → ordinary queue landing. Clause-②: no holds: the hit's wire shape is unchanged (record keeps the stored id, no key added, pinned), only the title value reads through, and the searchAll docblock states no title rule that this makes false; Metadata-protocol: none.
  • Security read (L1, security-touching): no finding. The target read is engine.find(target, { where: { id: { $in } }, fields: ['id', title], context: request.context }), so it passes the full gate (object, row scope, FLS, masking) as the searcher. Before it: canServeApiOperation(enable, 'get') and the sweep's own canReadObject. No system-context read is added. A context-less in-process call reads without a context exactly as the sweep's own find already does, so nothing widens. Search terms still match only the swept object's queryable fields, so the target title is display only and gives no search oracle. PERMISSION_DENIED from the target read keeps the bare id (correct for a second-object read, the $expand posture); every other failure propagates, as the sweep does (Measured set: five read seams answer a failed read from an empty accumulator with no log and no field saying the answer is incomplete #8896). The new caller is classified in the core second-object-read exposure pin.
  • Fixes vs the card: the card asks to measure on main first (done: 7 red on d6d96450, hits titled per_1/per_2), follow the reference to the target's ADR-0079 title as the searcher, keep the bare id for a refused reader, and keep the wire shape. All delivered. The card's named producer is wrong: sys_record_share.recipient_id is a polymorphic Field.text, not a lookup, so its palette title does not change. The dev's report comment on ⌘K palette hit titles a record by its raw lookup id when the object's nameField is a lookup #34175 records that correction in public; the lookup ask itself is met, so Fixes is right.
  • Changeset: .changeset/34175-search-lookup-title.md, patch on @objectstack/metadata-protocol (published). Sentences read against the diff: the reference types = referenceTargetOf; "one id $in read per searched object … id and the title column only" = readReferenceTitles, pinned; "A target whose declared API exposure does not serve get is not read" = servesSearchTitleTarget, pinned; "fails the search, as a failing record read in the same sweep already does" = the rethrow, pinned with code and status; "The hit's shape is unchanged" = pinned. One sentence to fix: "keeps the bare id, the same answer $expand gives that reader" is not true for a field declaring referenceNameVisible: true, where $expand answers { id, name, readRefused: true }. Reword it to say the bare id, as $expand answers on a field that does not declare referenceNameVisible. Carry this in the same push as the main merge below; a changeset-only edit does not come back for L1.
  • 差异由 L1 读过: hitRows is cut to overallLimit before the target read, so no target is read for a dropped row. Multi-value pointers title each element and join them with , . A target with no title field, or a title column absent from its field map, titles nothing.
  • 接受的偏差: (1) packages/core/src/security/second-object-read-exposure.pin.test.ts gains a CALLERS row and the decision-function name, outside the claim surface. The pin reds any unclassified referenceTargetOf caller; the edit is mechanical, declared and pinned. (2) The searchAll docblock in protocol.ts is not edited (outside the surface); the contract lives on the two new functions. (3) referenceNameVisible is not served here: a refused reader on such a field keeps the bare id. That is the stricter answer, and serving the name would need a system-context read, which is a disclosure decision. Accepted, with the card owed below.
  • Pins: 11 cases: the pin, one read per object as the searcher, wire shape, master_detail and user pointers, four REFUSED legs (object refused and never read, read throws PERMISSION_DENIED, row outside scope, FLS strips the title), exposure without get, outage fails the search (SERVICE_UNAVAILABLE/503 asserted), and a text-pointer CONTROL. Red on main 7/11; ablation of the canReadObject pre-check: 1 red (the object-refused leg) / 10 green, restored blob == HEAD.
  • 门禁: check-runs on head ff64484d: 59 success, 13 skipped, 0 failure (Lint & Repo Gates, TypeScript Type Check and all 10 Test Core shards among the successes). Dev local: 69 of 69 derived gate families exit 0, 0 NOT MEASURED.
  • 范围外去向 — two cards owed from ux-3, nested under ⌘K palette hit titles a record by its raw lookup id when the object's nameField is a lookup #34175, before or at close-out: (a) the record-share palette title: sys_record_share is titled by recipient_id, a polymorphic principal id paired with recipient_type, so its hits still show a raw id; the fix is a recipient-type-keyed directory read, a different design. (b) referenceNameVisible on the search title: a field declaring it serves the name on $expand but the bare id here. Filed as a decision question, since serving it needs a system-context read.
  • 落地条款: ⚠️ K = 18 first-parent commits on main since merge base d6d96450 (≥ 15). Per landing-operations.md, ux-3 merges main first, together with the changeset rewording above, waits for the re-run to go fully green, then pr_ready + auto-merge (unless GitHub reports behind). This ACCEPT stands across a main-only, conflict-free merge plus that changeset edit; a conflict resolution that touches the code comes back for L1. No locale pack. On MERGED, close-out on ⌘K palette hit titles a record by its raw lookup id when the object's nameField is a lookup #34175 naming the two cards.

… the changeset's $expand comparison

The changeset now says a refused reader keeps the bare id as $expand answers on a
field that does not declare referenceNameVisible (a declaring field answers
{ id, name, readRefused: true } there).

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZiaBg6rk7dpy1s9Me
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZiaBg6rk7dpy1s9Me

Landing · head 6e7422813b · after L1-a ACCEPT 6998964493 (stands across the clean main merge and the changeset rewording, L1-a confirmed) · 2026-11-19T04:20Z

Probe Reading
Checks at head 6e7422813b 57 success, 11 skipped, 0 failed; mergeable clean
check-governed-merges.mjs --pr 35292 NOT governed, 0 of 4 paths, 457 lines
K 0 at merge base bc75bcdbcd (main merged per the ACCEPT's K = 18 clause)
Changeset "keeps the bare id, the same answer $expand gives that reader" → "…keeps the bare id, as $expand answers that reader on a field that does not declare referenceNameVisible"

Follow-ups owed by the ACCEPT, nested under #34175: #35307 (record-share palette title), #35308 ([Decision] referenceNameVisible on the search title).
Status: pr_ready + automerge_enable. On MERGED the area closes out #34175 naming both.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 04:21
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 22af9e6 Nov 19, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34175-palette-lookup-title branch November 19, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⌘K palette hit titles a record by its raw lookup id when the object's nameField is a lookup

2 participants